package common.enums;

public enum DateOfBirthEnum {

	NULL(""),
	BEFORE_1900("before 1900"),
	FROM_1900_TO_1950("1900-1950"),
	FROM_1950_TO_1959("1950-1959"),
	FROM_1960_TO_1969("1960-1969"),
	FROM_1970_TO_1979("1970-1979"),
	FROM_1980_TO_1989("1980-1989"),
	FROM_1990_TO_1999("1990-1999"),
	AFTER_2000("after 2000");
	
	private String text;
	
	DateOfBirthEnum(String text) {
	  this.text = text;
	}
	
	public String getText() {
	  return this.text;
	}
	
	@Override
	public String toString() {
		return getText();
	}
	
	public static DateOfBirthEnum fromString(String text) {
	    if (text != null) {
	      for (DateOfBirthEnum b : DateOfBirthEnum.values()) {
	        if (text.equalsIgnoreCase(b.text)) {
	          return b;
		    }
		  }  
	    }
	    
	    return null;   
	}
	
}
